package com.yishun.springboot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.yishun.springboot.service.TbMenuService;

@RestController
@RequestMapping("/TbMenu")
public class TbMenuController {

	@Autowired
	TbMenuService tbMenuService;

	/**
	 * 新增按钮跟后端接口 还需要绑定接口权限等级并且赋予权限访问条件
	 * 
	 * @param jsonObject
	 * @return
	 */
	@RequestMapping("/addTbMenu")
	public String addTbMenu(@RequestBody JSONObject jsonObject) {

		return tbMenuService.addTbMenu(jsonObject).toJSONString();
	}

	/**
	 * 删除按钮 同时还会删除绑定的接口 跟权限等级
	 * 
	 * @param jsonObject
	 * @return
	 */
	@RequestMapping("/delTbMenu")
	public String delTbMenu(@RequestBody JSONObject jsonObject) {
		return tbMenuService.delTbMenu(jsonObject).toJSONString();
	}
}
